Skip to content

Conversation

@jkopanski
Copy link
Contributor

Often times my goal looks like this:

(match
  match multifill ["dataSlot"]
    (match
      match
        match
          match
	    Ok evm Inhabited.default🇪⟦mstore evm (OfNat.ofNat 0) account.val.cast⟧🇪⟦state_prep⟧🇪⟦res.2⟧⟦"key"↦key⟧⟦"slot"↦slot⟧⟦"_1"↦account.val.cast⟧ with
          | Ok evm store => ...
          | s => s with
        | Ok evm store => ...
        | s => s with
      | Ok evm store => ...
      | s => s with
    | Ok evm store => ...
    | s => s
...)

which can't simplify becasue Ok is wrapped in insert or setEvm functions. This tactic will move those under the Ok in order to progress matches and then try to reclaim the inserts.

Often times my goal looks like this:

```
(match
  match multifill ["dataSlot"]
    (match
      match
        match
          match
	    Ok evm Inhabited.default🇪⟦mstore evm (OfNat.ofNat 0) account.val.cast⟧🇪⟦state_prep⟧🇪⟦res.2⟧⟦"key"↦key⟧⟦"slot"↦slot⟧⟦"_1"↦account.val.cast⟧ with
          | Ok evm store => ...
          | s => s with
        | Ok evm store => ...
        | s => s with
      | Ok evm store => ...
      | s => s with
    | Ok evm store => ...
    | s => s
...)
```

which can't simplify becasue `Ok` is wrapped in `insert` or `setEvm`
functions.  This tactic will move those under the `Ok` in order to
progress matches and then try to reclaim the inserts.
@Coda-Coda
Copy link
Collaborator

Hi @jkopanski, what would be an example place to use this?

@jkopanski
Copy link
Contributor Author

Ah, I've forgot to push yesterday. See this commit: 9df1fda

In the balance/allowance case it seems that clr_varstore leaves unfolded State.insert and there is no EVMState modifications so there is already top level Ok constructor for state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants